package acm.usa2006.southcentral;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/*
 * p2580
 * ACM USA 2006 South Central
 */

public class p2580 {

	static int N;
	static int n;
	static String DNA;
	static Set<String> nc;
	static Set<String> c;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		N = scanner.nextInt();
		for (int i=1;i<=N;++i) {
			n = scanner.nextInt();
			c = new HashSet<String>();
			for (int j=1;j<=n;++j) {
				DNA = scanner.next();
				nc = new HashSet<String>();
				for (int k=0;k<60;++k) {
					for (int l=3;k+l<=60;++l) {
						String s = DNA.substring(k, k+l);
						if (j==1) {
							if (!nc.contains(s)) {
								nc.add(s);
							}
						}
						else {
							if (!nc.contains(s)) {
								if (c.contains(s)) {
									nc.add(s);
								}
							}
						}
					}
				}
				c = nc;
			}
			String s = null;
			int max = 0;
			Object[] objs = c.toArray();
			for (int j=0;j<objs.length;++j) {
				String tmp = (String)objs[j];
				int n = tmp.length();
				if (n > max) {
					max = n;
					s = tmp;
				}
				else if (n == max) {
					if (tmp.compareTo(s) < 0) {
						s = tmp;
					}
				}
			}
			if (max == 0) {
				System.out.println("no significant commonalities");
			}
			else {
				System.out.println(s);
			}
		}

	}

}
